<!--
  -- LIGHTSTREAMER - www.lightstreamer.com
  -- Lightstreamer HTML Client - lsengine.html
  -- Version 5.0 Build 1446.6 Revision: 30462 $
  -- Copyright (c) 2004-2011 Weswit Srl. All Rights Reserved.
  -->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Lightstreamer</title>
<script language="JavaScript" src="lscommons.js"></script>
<script language="JavaScript" src="lsengine.js"></script>

<script language="JavaScript">
  function LS_extractParam(name) {
    var pattern = new RegExp("[#?&]" + name + "=[^&]*");
    var result = pattern.exec(location.href);
    if (result && result[0]) {
      var prefLen = name.length + 2;
      if (window.decodeURIComponent) {
        return decodeURIComponent(result[0].substring(prefLen));
      } else {
        return unescape(result[0].substring(prefLen));
      }
    } else {
      return null;
    }
  }

  // the engineName parameter must be an alphanumeric string
  var LS_engineName = LS_extractParam("engineName");
  if (LS_engineName != null) {
    var alpha_numeric = new RegExp("^[a-zA-Z0-9]*$");
    if (! alpha_numeric.test(LS_engineName)) {
      LS_engineName = null;
    }
  }

  // the domain parameter must be an alphanumeric string with . and -
  var LS_domain = LS_extractParam("domain");
  if (LS_domain != null) {
    var alpha_numeric = new RegExp("^[a-zA-Z0-9\\.\\-]*$");
    if (! alpha_numeric.test(LS_domain)) {
      LS_domain = null;
    }
  }

  // the id parameter must be a number
  var LS_id = LS_extractParam("id");
  if(LS_id != null) {
    if (isNaN(LS_id)) {
      LS_id = null;
    }
  }

  var LS_build = LS_extractParam("build");
  var LS_remoteDebug = !LS_extractParam("remoteDebug") == "false";
  var LS_debugAlerts = !LS_extractParam("debugAlerts") == "false";
  var LS_d = LS_extractParam("d") == "true";
  var LS_suppressDefaultStatusChangeHandler = LS_extractParam("suppressDefaultStatusChangeHandler") == "true";

  var LS_engine = new Lightstreamer.LightstreamerEngine(LS_suppressDefaultStatusChangeHandler,LS_id,LS_engineName,LS_d,LS_build);
  LS_engine.context.setDebugAlertsOnClientError(LS_debugAlerts);
  LS_engine.context.setRemoteAlertsOnClientError(LS_remoteDebug);
  LS_engine.context.setDomain(LS_domain);
  LS_engine.bind();

</script>
</head>

<script language="JavaScript">
 var LS_formUrl = "lsform.html";
 var LS_blankUrl = "lsblank.html";
 if (LS_domain != null) {
  LS_formUrl += "?" + LS_domain;
  LS_blankUrl += "?domain=" + LS_domain;
 }
 var LS_engineFrameName = LS_engine.getEngineFrameName();

 document.writeln('<frameset rows="0,0,0,0,0,0" onLoad="LS_onld()" onUnload="LS_onunld()" border="0" frameborder="0" framespacing="0">');
 document.writeln('<frame name="LS__' + LS_engineFrameName + '" src="'+LS_blankUrl+'" border="0" frameborder="0" marginwidth="0" marginheight="0" noresize scrolling="no">');
 document.writeln('<frame name="LS_PUSHFRAME" src="'+LS_blankUrl+'" border="0" frameborder="0" marginwidth="0" marginheight="0" noresize scrolling="no">');
 document.writeln('<frame name="LS_POLLFRAME" src="'+LS_blankUrl+'" border="0" frameborder="0" marginwidth="0" marginheight="0" noresize scrolling="no">');
 document.writeln('<frame name="LS_FORMFRAME" src="' + LS_formUrl + '" border="0" frameborder="0" marginwidth="0" marginheight="0" noresize scrolling="no">');
 document.writeln('<frame name="LS_CONTROLFRAME" src="'+LS_blankUrl+'" border="0" frameborder="0" marginwidth="0" marginheight="0" noresize scrolling="no">');
 document.writeln('<frame name="LS_AJAXFRAME" src="'+LS_blankUrl+'" border="0" frameborder="0" marginwidth="0" marginheight="0" noresize scrolling="no">');
 document.writeln('</frameset>');
</script>

</html>
